import { ADDPERSON } from '../constant'
const initState = [
  {
    id: 1,
    name: 'A',
    age: 18
  }
]
// 形参的默认值
export default function countReducer(preState = initState, action) {
  const { type, data } = action
  switch (type) {
    case ADDPERSON:
        // 不能改写preState
      return [data, ...preState]
    default:
      return preState
  }
}
